from Tkinter import *
from tkMessageBox import *
from MVC.plstdocument import IDocument
from service.PlusterLog import PlusterLog
from service.XMLRPC import XMLRPC
from service.MainServer import MainServer
from localEnv import *
import re
import thread
import time


class DiskUsageView(Frame):
    def __init__(self,ctl):
        self.ctl=ctl
        
    def show(self,master):
        self.w=Toplevel(master)
        Frame.__init__(self,self.w)
        self.master.title("Pluster DiskUsage Task 0.1")
        self.grid()
        self.create()

    def create(self):
        "Create Widgets for View"
        Label(self,text="Original output from df -h:").grid(row=0,column=0)
        self.org=Text(self,width=70,height=20)
        self.org.grid(row=1,column=0,sticky=W)
        self.org_scroll=Scrollbar(self,orient=VERTICAL,command=self.org.yview)
        self.org_scroll.grid(row=1,column=1,sticky=N+S+E)
        self.org["yscrollcommand"]=self.org_scroll.set
        d=os.popen("df -h").read()
        self.org.insert(END,d)

            
    def Update(self,doc):
        pass
            

class DiskUsageAdapter:
    def __init__(self,doc):
        self.doc=doc
        
    def handle_diff(self):
        pass

class DiskUsageTask(IDocument,PlusterLog):
    def __init__(self):
        IDocument.__init__(self)
        PlusterLog.__init__(self)
        self.log.debug("Task __init__ done")
        
    def run(self):
        pass
        
      

    
        
